import 'package:fluent_ui/fluent_ui.dart';

import 'gyy_theme.dart';


class DialogConstant {
  static const  String ok = 'ok';
  static const  String cancel = 'cancel';
}

//确定 和取消的对话框
Future<String?> showContentDialog(BuildContext context, String text, {String title = '提示', String ok = 'ok', String cancel = 'cancel'})  async {
  return await showDialog<String>(
    context: context,
    builder: (context) => ContentDialog(
      title: Text(title),
      content:  Text(text),
      actions: [
        Button(
          child: Text(ok),
          onPressed: () {
            Navigator.pop(context, DialogConstant.ok);
            // Delete file here
          },
        ),
        FilledButton(
          child: Text(cancel),
          onPressed: () => Navigator.pop(context, DialogConstant.cancel),
        ),
      ],
    ),
  );
}

//只有确定的对话框
Future<String?> showConfirmDialog(BuildContext context, String text, {String title = '提示'})  async {
  return await showDialog<String>(
    context: context,
    builder: (context) => ContentDialog(
      title: Text(title),
      content: Text(text),
      actions: [
        Flex(
          children:[
            Expanded(child: FilledButton(
              child: const Text('ok'),
              onPressed: () => Navigator.pop(context, DialogConstant.ok),
            ))
          ],
           direction: Axis.horizontal,
        ),
      ],
    ),
  );
}

//跳转页面 的对话框
Future<String?> showWidgetDialog(BuildContext context, Widget content, {String title = '提示', String ok = 'ok', String cancel = 'cancel'})  async {
  return await showDialog<String>(
    context: context,
    builder: (context) => ContentDialog(
      // title: Text(title),
      content:  content,
      constraints: contentDialogConstraints,
      // actions: [
      //   Button(
      //     child: Text(ok),
      //     onPressed: () {
      //       Navigator.pop(context, DialogConstant.ok);
      //       // Delete file here
      //     },
      //   ),
      //   FilledButton(
      //     child: Text(cancel),
      //     onPressed: () => Navigator.pop(context, DialogConstant.cancel),
      //   ),
      // ],
    ),
  );
}